#!/usr/bin/env bash

set -euo pipefail

#DMENU='dmenu -m 0 -fn "mononoki Nerd Font:size=14" -nb "#181f21" -nf "#a7a7a7" -sb "#a7a7a7" -sf "#181f21" -x 0 -y 0 -z 1200 -h 34 -p'
DMENU="dmenu -i -h 34 -l 20 -z 990 -p"

options=("Power off"
"Reboot"
"Lock screen"
"Log out")

choice=$(printf '%s\n' "${options[@]}" | ${DMENU} 'Choose option' "${@}")

case $choice in
    "Power off")
        exec=$(systemctl poweroff)
    ;;
    "Reboot")
        exec=$(systemctl reboot)
    ;;
    "Lock screen")
        exec=$(slock)
    ;;
    "Log out")
        exec=$(kill -9 -1)
    ;;
esac 2>/dev/null
